/* UTF8 Encoding */
/*-----------------------------------------------------------------------
|                            FILE DESCRIPTION                           |
-----------------------------------------------------------------------*/
/*----------------------------------------------------------------------
  - File name     : servo.h
  - Author        : liuzhihua (liuzhihuawy@163.com)
  - Update date   : 2024.08.15
  - Brief         : 
  - Version       : v0.1
-----------------------------------------------------------------------*/
/*-----------------------------------------------------------------------
|                               UPDATE NOTE                             |
-----------------------------------------------------------------------*/
/**
  * Update note:
  * ------------   ---------------   ----------------------------------
  *     Date            Author                      Note
  * ------------   ---------------   ----------------------------------
  *  2024.08.15       liuzhihua                  Create file          
***/

#ifndef __SERVO_H
#define __SERVO_H

/*-----------------------------------------------------------------------
|                               INCLUDES                                |
-----------------------------------------------------------------------*/
#include <stdint.h>
#ifdef  __cplusplus
    extern "C" {
#endif
/*-----------------------------------------------------------------------
|                                DEFINES                                |
-----------------------------------------------------------------------*/
#define SERVO_STATE_NOINIT  0
#define SERVO_STATE_ENABLE  1
#define SERVO_STATE_DISABLE 2


typedef struct 
{
    int8_t state;
    uint16_t value;
    float angle;
    int (*init)(void);
    int (*writeAngle)(float angle);
    int (*writeValue)(uint32_t value);
    int (*writeEnable)(int state);
} servo_t;




/*-----------------------------------------------------------------------
|                                  API                                  |
-----------------------------------------------------------------------*/
extern servo_t servo1;
#ifdef __cplusplus
	}
#endif
#endif
